package com.tom.task;

import com.tom.service.IKillCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

//发布秒杀课程的任务
@Component
public class PublishKillCourseTask {

    @Autowired
    private IKillCourseService killCourseService;

    @Scheduled(cron = "0/2 * * * * ?")
    //或直接指定时间间隔，例如：5秒
    //@Scheduled(fixedRate=5000 ,initialDelay = 2000)
    private void publishKillCourse2Redis() {
        killCourseService.publishKillCourse2Redis();
    }
}
